<%@page import="java.util.LinkedList"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="GetData.DataWS"%>
<%@page import="dktc_ws.Tintuc"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<% request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    response.setContentType("text/html; charset=UTF-8"); 
%>


<h2>Danh sách tin tức</h2>  

<table id="rounded-corner" summary="">
    <thead>
    <tr>
            <th scope="col" class="rounded-company">  </th>
            <th scope="col" class="rounded">Tiêu đề</th>
            <th scope="col" class="rounded">Mô tả ngắn</th>
            <th scope="col" class="rounded">Ngày đăng</th>
            <th scope="col" class="rounded">Nội dung</th>
             <th scope="col" class="rounded">Sửa</th>
              <th scope="col" class="rounded-q4">Xóa</th>
        </tr>
    </thead>       
    <tbody> 
        <%
DataWS a=new DataWS();
List<Tintuc> dstintuc = a.laydanhsachtintuc(-1);
Tintuc news;

for(int i=0;i<dstintuc.size();i++)
       {
    news = dstintuc.get(i);
%>
        <tr>
            <td></td>
            <td><%=news.getTuade()%></td> 
            <td><%=news.getMotangan()%></td> 
            <td><%=news.getNgaydang()%></td> 
            <% int length = news.getNoidung().length();
            if (length > 30) length = 30;%>
            <td><%=news.getNoidung().substring(0,length-1) + "..."%></td>
            <td><a href="?page=edit_news&id=<%=news.getMatintuc()%>"><img src="images/user_edit.png" alt="" title="" border="0" /></a></td> 
            <td><a href="?page=delete_news&id=<%=news.getMatintuc()%>" class="ask"><img src="images/trash.png" alt="" title="" border="0" /></a></td> 
        </tr>      
    	      
        <%}

%>         
        
    
    </tbody>
</table>
<a href="?page=add_news" class="bt_green"><span class="bt_green_lft"></span><strong>Thêm Tin tức</strong><span class="bt_green_r"></span></a> 
     <!--a href="#" class="bt_blue"><span class="bt_blue_lft"></span><strong>View all items from category</strong><span class="bt_blue_r"></span></a--> 
        